package me.pplay.playtalk.activity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import me.pplay.playtalk.R;
import me.pplay.playtalk.adapter.CommonAdapter;
import me.pplay.playtalk.bean.CommonControlID;
import me.pplay.playtalk.callback.CommonAdapterOnClickCallBack;
import me.pplay.playtalk.util.LogManager;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;

public class BuddyInfoActivity extends BaseActivity {
	private List<Map<String, Object>> mData;
	private ListView list;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.layout_buddyinfo);
		mData = getData();
		CommonControlID holderId = new CommonControlID();
		holderId.itemLayout = R.layout.layout_communitylist;
		holderId.leftImgId = R.id.community_img;
		holderId.rightImgId = R.id.community_chat;
		holderId.leftStrId = R.id.community_title;
		holderId.leftStr1Id = R.id.community_topic;

		CommonAdapter adapter = new CommonAdapter(BuddyInfoActivity.this, mData, holderId, new CommonAdapterOnClickCallBack() {

			@Override
			public void OnClickCallback(int pos, int ViewId, View v) {
				// TODO Auto-generated method stub
				LogManager.LogShow("BuddyInfoActivity", "OnClickCallback position " + pos);

			}
		});
		list = (ListView) this.findViewById(R.id.buddyinfo_list); // 联系人ListView
		list.setAdapter(adapter);// 将数据适配器与Activity进行绑定
		
	}

	private List<Map<String, Object>> getData() {
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();


		Map<String, Object> map = new HashMap<String, Object>();
		map.put("leftStr", "G1");
		map.put("leftStr1", "google 1");
		map.put("leftImg", R.drawable.setting_icon);
		list.add(map);

		map = new HashMap<String, Object>();
		map.put("leftStr", "G2");
		map.put("leftStr1", "google 2");
		map.put("leftImg", R.drawable.setting_icon);
		list.add(map);

		map = new HashMap<String, Object>();
		map.put("leftStr", "G3");
		map.put("leftStr1", "google 3");
		map.put("leftImg", R.drawable.setting_icon);
		list.add(map);
		return list;
	}
}
